package com.inspur.jxpcxt.service;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

import com.inspur.jxpcxt.constants.ServerConstants;
import com.inspur.jxpcxt.utils.CommonService;

public class HomeCommitService {
	@SuppressWarnings("deprecation")
	public static String HomeCommitByClientGet(String tname, String cname, String sno,String sname, float avg, String grade, String tno)
		{

			// 创建HttpClient对象
			HttpClient client = new DefaultHttpClient();
			// 拼装路径
			String path = null;
			try {
				path = "http://"
						+ ServerConstants.SERVER_IP
						+ ":8080/Web/LoginServlet?tname="
						+ URLEncoder.encode(tname, "UTF-8")
						+ "&cname="
						+ URLEncoder.encode(cname, "UTF-8")
						+ "&sno="
						+ URLEncoder.encode(sno)
						+"&sname="
						+URLEncoder.encode(sname, "UTF-8")
						+ "&avg="
						+ URLEncoder.encode(avg + "")
						+ "&grade="
						+ URLEncoder.encode(grade, "UTF-8")
						+ "&tno="
						+ URLEncoder.encode(tno)
						+ "&service="
						+ URLEncoder.encode(
								ServerConstants.SERVER_HOME_SERVICE, "UTF-8");
			} catch (UnsupportedEncodingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return CommonService.serviceRequest(path, client);
		}

}
